package org.ljy.forum6.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.ljy.forum6.model.Article;

import java.util.List;

@Mapper
public interface ArticleMapper {
    int insert(Article row);

    int insertSelective(Article row);

    Article selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Article row);

    int updateByPrimaryKeyWithBLOBs(Article row);

    int updateByPrimaryKey(Article row);

    /**
     * 获取所有的文章
     * @return
     */
    List<Article> selectAll();

    /**
     * 获取版块下的所有文章
     * @param boardId
     * @return
     */
    List<Article> selectAllByBoardId(@Param("boardId") Long boardId);


    /**
     * 获取指定帖子详情
     * @return
     */
    Article selectDetailById(@Param("id") Long id);


    /**
     * 返回文章列表
     * @param userId
     * @return
     */
    List<Article> selectByUserId(@Param("userId") Long userId);

}